package com.xiaoyy.sso.web;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.core.io.ClassPathResource;

import java.util.ArrayList;
import java.util.List;

@Configuration
public class ApplicationConfigurer {

    @Bean
    public static PropertySourcesPlaceholderConfigurer createPropertySourcesPlaceholderConfigurer() {
        List<ClassPathResource> resourceLst = new ArrayList<ClassPathResource>();
        resourceLst.add(new ClassPathResource("application.properties"));
        resourceLst.add(new ClassPathResource("config/druid.properties"));
        resourceLst.add(new ClassPathResource("config/mybatisPlus.properties"));
        //resourceLst.add(new ClassPathResource("config/mybatis.properties"));
        //resourceLst.add(new ClassPathResource("config/redis.properties"));
        resourceLst.add(new ClassPathResource("config/sysconfig.properties"));
        resourceLst.add(new ClassPathResource("config/quartz.properties"));
        //resourceLst.add(new ClassPathResource("config/dubbo.properties"));
        PropertySourcesPlaceholderConfigurer propertyPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();
        propertyPlaceholderConfigurer.setLocations(resourceLst.toArray(new ClassPathResource[]{}));
        propertyPlaceholderConfigurer.setFileEncoding("UTF-8");
        return propertyPlaceholderConfigurer;
    }
}

